/*
 * @Author: ylq
 * @Date: 2022-09-19 11:37:51
 * @Desc: 用户登录AUTH
 * @Last Modified by: ylq
 * @Last Modified time: 2023-01-04 17:22:11
 */

import CONFIG from '../config/config';
import { tools } from './tools';

const isLogin = () => {
  return !!tools.getCookie(CONFIG.COOKIE_NAME);
};

const getToken = () => {
  return tools.getCookie(CONFIG.COOKIE_NAME);
};

const setToken = (token, day) => {
  tools.setCookie(CONFIG.COOKIE_NAME, token, day);
};

const clearToken = () => {
  tools.setCookie(CONFIG.COOKIE_NAME, '', -1);
};

export { isLogin, getToken, setToken, clearToken };
